import module from '../../module'

export default name => {
  const root = `${module.code}/${name}/`
  const crud = $http.crud(root)
  crud.querylineinfos = params => {
    console.log(params);
    return $http.get('/dispatch/common/querylineinfos', params)
  }
  crud.stationQuery = params => {
    return $http.get('/baseinfo/station/query', params)
  }
  crud.targetQuery = params => {
    return $http.get('/baseinfo/target_info/query', params)
  }
  crud.organizationQuery = params => {
    return $http.get('/baseinfo/organization/query', params)
  }
  // 售票模块
  // 售票数据
  crud.querycurrentuserbill = params => {
    return $http.get('/dispatch/common/querycurrentuserbill', params)
  }
  // 打印后票号+1
  crud.printticket = params => {
    return $http.post('/dispatch/common/printticket', params)
  }
  // 售票列表
  crud.queryrunbusinfo = params => {
    return $http.get('/dispatch/common/queryrunbusinfo', params)
  }
  // 售票预定
  crud.createorder = params => {
    return $http.post('/dispatch/common/createorder', params)
  }
  // 获取车次座位
  crud.getrunbusseatinfo = params => {
    return $http.get('/dispatch/common/getrunbusseatinfo', params)
  }
  // 获取车次途径站
  crud.getrunsectioninfo = params => {
    return $http.get('/dispatch/common/getrunsectioninfo', params)
  }
  // 获取默认车站
  crud.getstartstation = params => {
    return $http.get('/dispatch/common/getstartstation', params)
  }
  // 锁座
  crud.lockseat = params => {
    return $http.post('/dispatch/common/lockseat', params)
  }
  // 解锁锁座
  crud.canclelockseat = params => {
    return $http.post('/dispatch/common/canclelockseat', params)
  }
  // 查询优惠比例
  crud.getdisrate = params => {
    return $http.get('/dispatch/common/getdisrate', params)
  }
  // 车票类型查询
  crud.ticketType = params => {
    return $http.get('/baseinfo/ticket_type/query', params)
  }
  // 座位类型查询
  crud.seatType = params => {
    return $http.get('/baseinfo/seat_type/query', params)
  }
  // 以下检票模块——————
  // 车辆检票   -   生成结算单
  crud.createbookingsheet = params => {
    return $http.get('/dispatch/common/createbookingsheet', params)
  }
  // 生成检票记录，并返回检票信息
  crud.createcheckticketinfo = params => {
    return $http.get('/dispatch/common/createcheckticketinfo', params)
  }
  // 查询单个的结算单
  crud.GetOneBookSheet = params => {
    return $http.get('/dispatch/common/GetOneBookSheet', params)
  }
  // 检票统计查询
  crud.checkstatistics = params => {
    return $http.get('/dispatch/common/checkstatistics', params)
  }
  // 检票业务中查询座位状态
  crud.queryseatstatus = params => {
    return $http.get('/dispatch/common/queryseatstatus', params)
  }
  // 获取打印结算单数据
  crud.booksheetprint = params => {
    return $http.get('/dispatch/common/booksheetprint', params)
  }
  // 获取结算单表
  crud.getcheckinfo = params => {
    return $http.get('/dispatch/common/getcheckinfo', params)
  }

  // 结算单打印页面——————————
  // 结算单列表
  crud.querybooksheet = params => {
    return $http.get('/dispatch/common/querybooksheet', params)
  }
  // 作废结算单
  crud.canclebooksheet = params => {
    return $http.get('/dispatch/common/canclebooksheet', params)
  }
  // 结算单重打
  crud.booksheetprintagain = params => {
    return $http.get('/dispatch/common/booksheetprintagain', params)
  }
  // 换车
  crud.booksheettochangecar = params => {
    return $http.get('/dispatch/common/booksheettochangecar', params)
  }
  return {
    ...crud
  }
}
